<html>
<head><meta charset="utf-8"><title>rust-analyzer#878 - Add missing impl members · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html">rust-analyzer#878 - Add missing impl members</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="160104359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160104359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160104359">(Mar 06 2019 at 15:19)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="133169">@matklad</span>, figured it'd be good to create a topic for that</p>



<a name="160104439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160104439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160104439">(Mar 06 2019 at 15:20)</a>:</h4>
<p>I'm first trying to do the basic approach, which is to complete simple <code>impl SomeTrait for SomeStruct</code> block and I have a question regarding syntax nodes</p>



<a name="160104503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160104503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160104503">(Mar 06 2019 at 15:21)</a>:</h4>
<p>if I understand correctly, we want to offer this assist when the cursor is under the <code>WHITESPACE, ITEM_LIST, IMPL_BLOCK</code> path (child -&gt; parent direction), correct?</p>



<a name="160104549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160104549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160104549">(Mar 06 2019 at 15:21)</a>:</h4>
<p>Yeah</p>



<a name="160104639"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160104639" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160104639">(Mar 06 2019 at 15:22)</a>:</h4>
<p>I'd say this simpler, "cursor has <code>ImplBlcok</code> as an ancestor"</p>



<a name="160104660"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160104660" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160104660">(Mar 06 2019 at 15:22)</a>:</h4>
<p>So, even if you are inside the function, the assist is applicable (if there are some non-oferriden functions)</p>



<a name="160104702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160104702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160104702">(Mar 06 2019 at 15:23)</a>:</h4>
<p>but what if the cursor is inside: <code>impl X for Y { fn some (&amp;self) {&lt;|&gt;} }</code>?</p>



<a name="160104708"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160104708" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160104708">(Mar 06 2019 at 15:23)</a>:</h4>
<p>oh yeah</p>



<a name="160104711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160104711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160104711">(Mar 06 2019 at 15:23)</a>:</h4>
<p>That is, being super-fine-grained about where assist is applicable is usually to super important</p>



<a name="160104730"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160104730" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160104730">(Mar 06 2019 at 15:23)</a>:</h4>
<p>I thought we want to do that only when the cursor is in a 'freestanding' position in the impl block</p>



<a name="160104745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160104745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160104745">(Mar 06 2019 at 15:23)</a>:</h4>
<p>is usually <strong>not</strong> super important</p>



<a name="160104752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160104752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160104752">(Mar 06 2019 at 15:23)</a>:</h4>
<p>gotcha</p>



<a name="160104816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160104816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160104816">(Mar 06 2019 at 15:24)</a>:</h4>
<p>another question - I did found the ast::ImplBlock node but I can't seem to find the path to a trait</p>



<a name="160104827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160104827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160104827">(Mar 06 2019 at 15:24)</a>:</h4>
<p>the observation here is that we only show assist if there are some methods missing. So we won't create a spurious entry in assist popup</p>



<a name="160104851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160104851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160104851">(Mar 06 2019 at 15:24)</a>:</h4>
<p>I think this is implemented manually in <a href="http://ast.rs" target="_blank" title="http://ast.rs">ast.rs</a></p>



<a name="160104881"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160104881" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160104881">(Mar 06 2019 at 15:25)</a>:</h4>
<p>(the awkward moment when you browse to a Serbian site <span aria-label="laughter tears" class="emoji emoji-1f602" role="img" title="laughter tears">:laughter_tears:</span> )</p>



<a name="160104884"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160104884" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160104884">(Mar 06 2019 at 15:25)</a>:</h4>
<div class="codehilite"><pre><span></span>impl ImplBlock {
    pub fn target_type(&amp;self) -&gt; Option&lt;&amp;TypeRef&gt; {
        match self.target() {
            (Some(t), None) | (_, Some(t)) =&gt; Some(t),
            _ =&gt; None,
        }
    }

    pub fn target_trait(&amp;self) -&gt; Option&lt;&amp;TypeRef&gt; {
        match self.target() {
            (Some(t), Some(_)) =&gt; Some(t),
            _ =&gt; None,
        }
    }
</pre></div>



<a name="160104918"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160104918" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160104918">(Mar 06 2019 at 15:25)</a>:</h4>
<p>:D</p>



<a name="160104921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160104921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160104921">(Mar 06 2019 at 15:25)</a>:</h4>
<p>ah! I was browsing the generated impls and couldn't find it</p>



<a name="160104925"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160104925" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160104925">(Mar 06 2019 at 15:25)</a>:</h4>
<p>thanks!</p>



<a name="160105022"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160105022" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160105022">(Mar 06 2019 at 15:26)</a>:</h4>
<p>Yeah, these can't be generated, because we use a stupid "find first node of appropriate type" approach, and there are two types</p>



<a name="160105040"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160105040" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160105040">(Mar 06 2019 at 15:26)</a>:</h4>
<p>but will the target_trait be the trait we implement for a given... target?</p>



<a name="160105071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160105071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160105071">(Mar 06 2019 at 15:26)</a>:</h4>
<p>(confused about naming, want to double check)</p>



<a name="160105107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160105107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160105107">(Mar 06 2019 at 15:27)</a>:</h4>
<p>yeah, <code>target_trait</code> should be a <code>Trait</code>, <code>target_type</code> should be a <code>Type</code>. references to traits and types use the same grammar</p>



<a name="160105151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160105151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160105151">(Mar 06 2019 at 15:27)</a>:</h4>
<p>And I actually can't recall an easy way to resolve <code>ast::TypeRef</code> to a trait...</p>



<a name="160105161"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160105161" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160105161">(Mar 06 2019 at 15:28)</a>:</h4>
<p>perhaps we just don't have one and it needs to be implemented?</p>



<a name="160105242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160105242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160105242">(Mar 06 2019 at 15:28)</a>:</h4>
<p>To do this, you'll need to check that <code>TypeRef</code> is, in fact, a path type, and resolve it</p>



<a name="160105353"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160105353" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160105353">(Mar 06 2019 at 15:29)</a>:</h4>
<blockquote>
<p>perhaps we just don't have one and it needs to be implemented?</p>
</blockquote>
<p>yeah I think we don't have it yet, will soon need it though ;)</p>



<a name="160105451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160105451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160105451">(Mar 06 2019 at 15:30)</a>:</h4>
<p>that the target trait is a <code>TypeRef</code> is actually a bit weird, but I guess syntactically it is</p>



<a name="160105467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160105467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160105467">(Mar 06 2019 at 15:30)</a>:</h4>
<p>though I wonder if it should maybe already be a different type in the HIR</p>



<a name="160105475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160105475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160105475">(Mar 06 2019 at 15:30)</a>:</h4>
<p>cool, thanks! I'll look around some more then</p>



<a name="160113006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160113006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160113006">(Mar 06 2019 at 16:54)</a>:</h4>
<p>Sorry it's going so slow, still trying to wrap my head around the structure and HIR</p>



<a name="160113040"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160113040" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160113040">(Mar 06 2019 at 16:55)</a>:</h4>
<p><span class="user-mention" data-user-id="133169">@matklad</span> from what I understand I can get resolver for a current position via <code>hir::source_binder::resolver_for_position</code></p>



<a name="160113048"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160113048" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160113048">(Mar 06 2019 at 16:55)</a>:</h4>
<p>and I need that <code>Resolver</code> to <code>resolve_path</code></p>



<a name="160113098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160113098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160113098">(Mar 06 2019 at 16:56)</a>:</h4>
<p>so I think I did all that and I think I can see two approaches clearing up - HIR-based (using more concrete definitions) and syntax-based (operating solely on nodes)</p>



<a name="160113140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160113140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160113140">(Mar 06 2019 at 16:56)</a>:</h4>
<p>you were saying you prefer syntax-oriented solution, right?</p>



<a name="160113203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160113203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160113203">(Mar 06 2019 at 16:57)</a>:</h4>
<p>right now, basically I go from <code>hir::Trait</code> (obtained via <code>Resolver::resolve_path</code> and the inner <code>hir::Resolution::Def(hir::ModuleDef::Trait(trait: hir::Trait))</code>) by calling <code>source()</code> which gets me <code>ast::TraitDef</code></p>



<a name="160113312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160113312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160113312">(Mar 06 2019 at 16:59)</a>:</h4>
<p>I assume I need to scan the syntax children of that <code>ast::TraitDef</code>, get <code>ItemList</code> and compare the difference with the <code>ItemList</code> returned from our <code>ast::ImplBlock</code>? (Excuse the types and paths everywhere, still trying to build a mental model of everything here <span aria-label="smiley" class="emoji emoji-1f603" role="img" title="smiley">:smiley:</span> )</p>



<a name="160113766"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160113766" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160113766">(Mar 06 2019 at 17:04)</a>:</h4>
<p>Yeah, I think that's a possible approach</p>



<a name="160113791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160113791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160113791">(Mar 06 2019 at 17:04)</a>:</h4>
<p>using syntax is nice, because you can copy-paste function prototype, with argument names and such</p>



<a name="160113798"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160113798" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160113798">(Mar 06 2019 at 17:04)</a>:</h4>
<p>with hir approach, you'll have to reconstruct the signature yourself</p>



<a name="160113842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160113842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160113842">(Mar 06 2019 at 17:05)</a>:</h4>
<p>right, makes sense</p>



<a name="160113865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160113865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160113865">(Mar 06 2019 at 17:05)</a>:</h4>
<p>Thanks!</p>



<a name="160114120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160114120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160114120">(Mar 06 2019 at 17:08)</a>:</h4>
<p>In other words, for Hir, long-term, we'll need a pretty-printing infra  with the logic like "if the source is available, use that; otherwise, synthesize arbitrary names and pretty-print the code". </p>
<p>However, building that infra requires some effort, and we can totally live without it for now :)</p>



<a name="160114746"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160114746" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160114746">(Mar 06 2019 at 17:16)</a>:</h4>
<p>yeah, figured that might be the case</p>



<a name="160114757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160114757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160114757">(Mar 06 2019 at 17:16)</a>:</h4>
<p>Gotta dash now, got to fetching the impl items list for both trait def and the current impl block</p>



<a name="160114765"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160114765" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160114765">(Mar 06 2019 at 17:16)</a>:</h4>
<p>I'll continue later today :)</p>



<a name="160114873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160114873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160114873">(Mar 06 2019 at 17:18)</a>:</h4>
<p>BTW, here's the code here from IntelliJ: <a href="https://github.com/intellij-rust/intellij-rust/blob/master/src/main/kotlin/org/rust/ide/refactoring/implementMembers/impl.kt" target="_blank" title="https://github.com/intellij-rust/intellij-rust/blob/master/src/main/kotlin/org/rust/ide/refactoring/implementMembers/impl.kt">https://github.com/intellij-rust/intellij-rust/blob/master/src/main/kotlin/org/rust/ide/refactoring/implementMembers/impl.kt</a></p>



<a name="160115378"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160115378" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160115378">(Mar 06 2019 at 17:23)</a>:</h4>
<p>we'd want to insert type parameters if you have something like <code>impl Trait&lt;Foo&gt; for MyStruct</code> though, so we won't be able to just use AST...</p>



<a name="160115402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160115402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160115402">(Mar 06 2019 at 17:23)</a>:</h4>
<p>I mean, for now it's fine I'd say, but it's something to think about</p>



<a name="160115466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160115466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160115466">(Mar 06 2019 at 17:24)</a>:</h4>
<p>Yeah, that the bit of that "elaborate pretty printing"</p>



<a name="160115521"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160115521" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160115521">(Mar 06 2019 at 17:25)</a>:</h4>
<p>Ideally, hir should not care about parameter names (patterns), and ast should not care about substitutions, and there should be a separate thing to unify the two</p>



<a name="160151100"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160151100" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160151100">(Mar 06 2019 at 23:26)</a>:</h4>
<p>I'm trying to figure out what node to replace in order to get proper indent</p>



<a name="160151128"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160151128" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160151128">(Mar 06 2019 at 23:26)</a>:</h4>
<p>and it seems like the last "whitespace" node for the children of ItemList make sense</p>



<a name="160151161"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160151161" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160151161">(Mar 06 2019 at 23:27)</a>:</h4>
<p>I'd like to do<code>children().rev()</code> but it seems that DoubleEndedIterator is not implemented for SyntaxNodeChildren</p>



<a name="160151173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160151173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160151173">(Mar 06 2019 at 23:27)</a>:</h4>
<p>however looking at <a href="https://docs.rs/rowan/0.3.3/src/rowan/lib.rs.html#450-453" target="_blank" title="https://docs.rs/rowan/0.3.3/src/rowan/lib.rs.html#450-453">https://docs.rs/rowan/0.3.3/src/rowan/lib.rs.html#450-453</a> I think this should be trivial? Or am I missing anything</p>



<a name="160151251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160151251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160151251">(Mar 06 2019 at 23:28)</a>:</h4>
<p>(I guess I might as well do <code>.children().filter_map(ast::Whitespace::cast).last()</code> or similar, just this popped up so figured I'd ask away)</p>



<a name="160181613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160181613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160181613">(Mar 07 2019 at 09:22)</a>:</h4>
<p>I feel like there's no good answer currently for getting the proper indent :)</p>



<a name="160181629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160181629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160181629">(Mar 07 2019 at 09:22)</a>:</h4>
<p>The ideal workflow would be to insert nodes somehow, and than to ask (currently non-existent) formatting infra "re-indent these newly inserted nodes"</p>



<a name="160181762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160181762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160181762">(Mar 07 2019 at 09:24)</a>:</h4>
<p>So, I suggest not to handle indent at all, for the initial implementation: it would still be extremely useful, and one can reforamt the whole file</p>



<a name="160181979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160181979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vipentti <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160181979">(Mar 07 2019 at 09:29)</a>:</h4>
<p>I think as long as the simple case, where the impl is on the top level of the file with no indentation, works, that should be enough when it comes to indentation. Rest of the indenting should be fixed when we have basic indentation formatter.</p>



<a name="160182074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160182074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vipentti <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160182074">(Mar 07 2019 at 09:30)</a>:</h4>
<p>e.g. </p>
<div class="codehilite"><pre><span></span><span class="k">trait</span><span class="w"> </span><span class="n">Trait</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">thing</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
<span class="k">struct</span> <span class="nc">Foo</span><span class="p">;</span><span class="w"></span>
<span class="k">impl</span><span class="w"> </span><span class="n">Trait</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">thing</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="160182114"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160182114" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> vipentti <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160182114">(Mar 07 2019 at 09:31)</a>:</h4>
<p>But in the end you can always run <code>rustfmt</code> to properly format it anyway</p>



<a name="160182738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160182738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160182738">(Mar 07 2019 at 09:41)</a>:</h4>
<p>That said, children should definitelly be a double-ended iterator! Could you send a PR to rowan?</p>



<a name="160208985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160208985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160208985">(Mar 07 2019 at 15:47)</a>:</h4>
<p>Posted a PR <a href="https://github.com/rust-analyzer/rust-analyzer/pull/947" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/pull/947">https://github.com/rust-analyzer/rust-analyzer/pull/947</a> that hopefully closes this issue <span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span></p>



<a name="160209241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160209241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Igor Matuszewski <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160209241">(Mar 07 2019 at 15:50)</a>:</h4>
<p>And yeah, I'll send a PR <span aria-label="thumbs up" class="emoji emoji-1f44d" role="img" title="thumbs up">:thumbs_up:</span></p>



<a name="160209317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer%23878%20-%20Add%20missing%20impl%20members/near/160209317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/rust-analyzer.23878.20-.20Add.20missing.20impl.20members.html#160209317">(Mar 07 2019 at 15:51)</a>:</h4>
<p>yep, reviewing it right now, looks good!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>